package cn.t.enums.order;

import cn.t.core.enums.Enumer;
import cn.t.core.enums.base.CommonEnum;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;

/**
 * @author l
 */

@Enumer
@Getter
@AllArgsConstructor
public enum MsvmOrderStatusEnum  implements CommonEnum<Integer, String> {

    ERR_ORDER(-100, "异常订单"),
    NORMAL(5, "正常订单"),
    CHANGETONORMAL(6, "人工转正常订单");
    public  static  final List<Integer> NORMALCODES = Arrays.asList(NORMAL.getCode(),CHANGETONORMAL.getCode());
    public  static  final List<Integer> ERRCODES = Arrays.asList(ERR_ORDER.getCode(),CHANGETONORMAL.getCode());
    @JsonValue
    @EnumValue
    private final Integer code;
    private final String name;
    public  static  String getDescByKey(Integer key) {
        for (MsvmOrderStatusEnum value : MsvmOrderStatusEnum.values()) {
            if (value.getCode().equals(key)) {
                return value.getName();
            }
        }
        return null;
    }

}
